package ACWing._785快速排序;

import java.util.Random;
import java.util.Scanner;

public class Main2 {
    static void quicksort(int[] a,int l,int r){
        if(l>=r)
            return;
        int i=l-1,j=r+1,x = a[l+r >> 1];
        while (i<j){
            do{i++;} while (a[i]<x);
            do{j--;} while (a[j]>x);
            if(i<j) {
                int t = a[i]; a[i] = a[j]; a[j] = t;
            }
        }
        quicksort(a,l,j);
        quicksort(a,j+1,r);
    }


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        quicksort(a,0,n-1);
        System.out.print(a[0]);
        for (int i = 1; i < n; i++) {
            System.out.print(" "+a[i]);
        }

    }
}
